package com.example.myapplication.apter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.myapplication.Config.TokenBean;
import com.example.myapplication.R;
import com.example.myapplication.ShuJu.DisheslistlistBean;
import com.example.myapplication.ShuJu.StorereviewBean;

import java.util.List;

public class DisheslistlistApter extends RecyclerView.Adapter<DisheslistlistApter.MyHolder>{
    private Context context;
    private List<DisheslistlistBean.DataBean> list;

    public DisheslistlistApter(Context context, List<DisheslistlistBean.DataBean> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public DisheslistlistApter.MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_disheslist,null);
        return new DisheslistlistApter.MyHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull DisheslistlistApter.MyHolder holder, int position) {
        try {

            holder.name.setText(list.get(position).getName());
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Override
    public int getItemCount() {
        return list == null ? 0 : list.size();
    }

    class MyHolder extends RecyclerView.ViewHolder {

        private final TextView name;
        private final RelativeLayout re;


        public MyHolder(@NonNull View itemView) {
            super(itemView);
            re = itemView.findViewById(R.id.re);
            name = itemView.findViewById(R.id.name);
        }
    }
}





